<template>
  <div class="horizontal_menu">
    <div class="head_menu">
      <div v-for="(item,index) in menuList" :key="index" class="menu_item" :class="{'choose_menu':item.platformCode === code}" @click="gotoDetail(item)">
        <a>{{ item.name }}</a>
      </div>
    </div>
    <div class="menu_child move">

    </div>
  </div>
</template>

<script>
import {getHorizontalMenu} from "../../utils/menuAuth";
import {getToken} from "../../utils/auth";
import {getPlatformCode} from "../../utils/code";

export default {
  data() {
    return {
      code:getPlatformCode(),
      menuList: []
    }
  },

  mounted() {
    let menu = getHorizontalMenu();
    this.menuList = menu ? JSON.parse(menu) : [];
  },

  methods: {
    gotoDetail(obj) {
      if (obj.platformCode !== this.code) {
        location.href = obj.url + '/transfer?t=' + getToken();
      }
    }
  }
}
</script>

<style scoped>
/*.horizontal_menu:hover .menu_child {*/
/*  display: block;*/
/*  height: 100px;*/
/*}*/

.head_menu {
  display: flex;
  align-items: center;
}

.head_menu .menu_item {
  cursor: pointer;
  line-height: 60px;
  padding: 0 15px;
  color: #fff;
  position: relative;
}

.head_menu .choose_menu,.head_menu .menu_item:hover {
  background: rgba(68, 126, 239, 0.8);
}



.head_menu .menu_item:hover .child_list{
  height: 100px;
  box-shadow: 0 10px 20px 0 #bbb;
}

.head_menu .menu_item:hover .child_list p{
  display: block;
}
.head_menu .menu_item a{
  color: #fff;
}

.head_menu .child_list {
  position: absolute;
  height: 0;
  overflow: hidden;
  left: 0;
  right: 0;
  top: 60px;
  z-index: 100;
  background: #fff;
}

.child_list p{
  display: none;
  color: #111;
  font-size: 14px;
  line-height: 30px;
  padding:0 10px;
}

.menu_child {
  position: fixed;
  top: 60px;
  left: 214px;
  right: 0;
  background: #fff;
  height: 0;
  z-index: 100;
  box-shadow: 0 10px 30px 0 #bbb;
}
</style>
